// dlg.txt

//MK Edit
//mark_quest_dest(zone,x,y,layer,quest);
//	code =
//		sf(,,2);
//		toggle_quest(19,10);
//		award_party_xp(MED_QUEST_XP);
//	break;

begintalkscript;

variables;

short this_town = 63;

begintalknode;
	tag = 1;
	condition = get_sdf(this_town,1) == 0;
	text1 = "This hall is ancient, like most of the ruins here. It is also surprisingly intact. There are cracks in the floor. A few tiles have fallen out of the ceiling. Yet, it is still almost entirely intact. It's very cold.";
	text2 = "Ominous statues stare at you as you pass. You see no signs, messages, runes, or other indications of what this place was built for. There are a few pairs of human tracks on the frost under your feet. Someone visited recently.";
	code =
		sf(this_town,1,1);
	break;
	
begintalknode;
	tag = 2;
	condition = get_sdf(this_town,2) == 0;
	text1 = "This complex has a large, impressive entry hall. Again, it is mostly intact, except for some scattered broken tiles and a few piles of trash left by looters.";
	text2 = "There are two things of note here. In the northwest corner, you see a small campsite. There is a tent and a cold firepit. Refuse and crumbling books are scattered on the floor around it. The camp hasn't been here for long. It looks like it was abandoned a few days ago.";
	text3 = "The second thing is quite a bit more interesting. There is a magic circle in the northeast corner. A huge magical construct stands in it. It's a familiar design, like a huge brute. However, it is very, very old. Its skin has a gray tint, like stone. It is amazing that it is still standing upright.";
	text4 = "It gives no response to your entry. It stands perfectly still, hunched over and staring straight ahead.";
	code =
		sf(this_town,2,1);
	break;

begintalknode;
	tag = 3;
	condition = get_sdf(this_town,3) == 0;
	text1 = "The stillness of the library is broken. You hear someone nearby. A man, most likely, shuddering and whispering to himself.";
	code =
		sf(this_town,3,1);
	break;

begintalknode;
	tag = 4;
	condition = get_sdf(this_town,4) == 0;
	text1 = "This hall is a magical workshop. The tools are strange. The runes on the walls and floor are weird and alien. Yet, the purpose of the hall is clear.";
	text2 = "Most of the flasks and tools are long-broken. There is a magic circle in the middle of the floor. Only one mechanism still seems intact. There is a pedestal in the far corner. A stone switch protrudes from the top.";
	code =
		sf(this_town,4,1);
	break;

begintalknode;
	tag = 5;
	condition = get_sdf(this_town,5) == 0;
	text1 = "You think you know what this hall is now. There is a wooden case to the left, full of scrolls. The cold has left them remarkably intact. They have been kept here, perfectly preserved, for centuries.";
	text2 = "You take a rolled-up sheet of leather off the shelf and inspect it. It is full of incomprehensible runic writing, accompanied by strange abstract drawings. You look at more of the scrolls. All similar.";
	text3 = "For the sages of Haven, this place could be an irreplaceable treasure trove. They could spend countless years here decoding the secrets of a lost civilization. Alas, for you, it's not useful at the moment.";
	code =
		sf(this_town,5,1);
	break;

begintalknode;
	tag = 6;
	condition = get_sdf(this_town,6) == 0 && gf(63,17) == 0;
	text1 = "The path ahead is blocked. Several massive stone pillars extend up out of holes in the brick floor, preventing your escape.";
	code =
		sf(this_town,6,1);
	break;

begintalknode;
	tag = 7;
	condition = get_sdf(this_town,7) == 0;
	text1 = "__";
	code =
		sf(this_town,7,1);
	break;

begintalknode;
	tag = 8;
	condition = get_sdf(this_town,8) == 0;
	text1 = "__";
	code =
		sf(this_town,8,1);
	break;

begintalknode;
	tag = 9;
	condition = get_sdf(this_town,9) == 0;
	text1 = "__";
	code =
		sf(this_town,9,1);
	break;

begintalknode;
	tag = 10;
	condition = get_sdf(this_town,10) == 0;
	text1 = "__";
	code =
		sf(this_town,10,1);
	break;

begintalknode;
	tag = 11;
	condition = get_sdf(this_town,11) == 0;
	text1 = "__";
	code =
		sf(this_town,11,1);
	break;

begintalknode;
	tag = 12;
	condition = get_sdf(this_town,12) == 0;
	text1 = "__";
	code =
		sf(this_town,12,1);
	break;

// MIXED

begintalknode; //doormess
	tag = 13;
	condition = 1;
	text1 = "When you touch the door, it gives you a nasty shock. Something is still powering the magical defenses of the library.";

begintalknode;
	tag = 14;
	condition = 1;
	text1 = "You examine the construct. Poke it. Rap it with your knuckles a few times. It seems like solid stone. Yet, its joints are covered with fine traceries of cracks. You aren't sure if it can move now, but it could definitely move once.";
	text2 = "It may be the most imposing magical construct you have ever seen. Very large and very solid. A ferocious opponent in battle, if it could ever move fast enough to fight.";
	
begintalknode;
	tag = 15;
	condition = 1;
	text1 = "You flip a few of the stone switches. Most of them do nothing. Then something happens. There is a loud hum. The air fills with energy. Your hair stands on end.";
	text2 = "Then, with a loud zapping noise and a flash of blinding light, a bolt of energy arcs into the middle of the circle to the west.";
	text3 = "Nothing else happens.";
	text4 = "The stone sentinel shudders and lets out another of its hideous screeches. Its stone shell grows soft and flexible, though it immediately begins to harden again.";
	code =
		play_sound(715);
		sf(63,15,4);
		rs(3);
		rs(4);
		if (char_ok(6300) == FALSE)
			as(3);
			else if (dist_to_nav_point(6300,5) <= 2) {
				as(4);
				sf(63,16,3);
				
				sf(63,25,1);
				
				run_text_on_char(6300,"Skin softens!",0);
				set_percent_adjust(6300,0,20);
				set_percent_adjust(6300,1,20);
				set_percent_adjust(6300,4,20);
				set_percent_adjust(6300,5,20);
				set_amount_adjust(6300,0,1);
				set_amount_adjust(6300,1,1);
				}
				else as(3);
	break;
	
begintalknode;
	tag = 16;
	condition = 1;
	text1 = "You flip the switch. There is a hum and a faint zapping noise, but nothing else happens. It must not have recharged yet.";

begintalknode;
	tag = 17;
	condition = 1;
	text1 = "You try to talk to Ezequiel, but he shakes his head. _Perhaps we should concentrate on escaping. I've told you all I know._";

begintalknode;
	tag = 18;
	condition = 1;
	text1 = "At last, your blow disrupts the magic holding the stone sentinel together. Its irritatingly hard skin grows soft. Then it cracks. Then disgusting goo comes out, first as an ooze and then as a gusher. Then the whole construct falls apart.";
	text2 = "It's actually a great shame. Haven's sages could have studied the thing and tried to learn how to reproduce it. Fortunately, once the rebellion is crushed, you can send a team up here to look at the scrolls.";
	text3 = "This side trip might not be a gigantic waste of time after all.";

begintalknode;
	tag = 19;
	condition = 1;
	text1 = "When you are close to this magical circle, a trap is activated. It's magical, ancient, and simple. You hear the mournful clang of the entry gate slamming shut behind you.";

begintalknode;
	tag = 20;
	condition = 1;
	text1 = "You try to talk to Ezequiel, but he shakes his head. _There are lots of barriers ahead. I'll hide here. You should find a way to open them._";
	text2 = "Your gentle suggestions that perhaps he should help fight are not accepted. _I'm a scavenger, not a warrior. I'm very good at hiding, though._";
	
begintalknode;
	tag = 21;
	condition = 1;
	text1 = "You have managed to heavily damage the sentinel. Unfortunately, its creators prepared for this.";
	text2 = "It freezes solid. Runes start to glow on its skin, as the wounds you inflicted begin to knit together.";
	text3 = "It's dispiriting to watch your work be undone, but at least the horror will leave you alone for a bit. Whatever powerful enchantments the ancients placed on this beast, you won't be able to overcome them with brute force.";
	
begintalknode;
	tag = 22;
	condition = 1;
	text1 = "__";

////

begintalknode;
	tag = 30;
	state = -1;
	nextstate = 10;
	condition = 1;
	question = "Name";
	text1 = "There is a man of the Ro hiding in this corner of the ruin. He is skinny and shivering. He's probably been trapped in here for quite a while. Still, when he sees you, he rises and tries to act much more confident and brave than he is.";
	text2 = "_What a pleasure. I hadn't dared hope for a visitor to my chilly little home. I am Ezequiel. An explorer and treasure hunter by trade._";
	text5 = "Ezequiel chats and banters and jokes with you, but he can't hide his impatience. He is scared and desperately wants to escape from here.";
	action = INTRO;

begintalknode;
	state = 10;
	nextstate = 11;
	condition = gf(63,10) == 0;
	question = "_I am [P] [N] of Haven._";
	text1 = "Ezequiel snorts with disbelief. Then he sees the insignia on your shoulder. _Oh. Well. Surprises upon surprises. It is a great honor to be locked in a frozen crypt with such company._";

begintalknode;
	state = 10;
	nextstate = 11;
	condition = gf(63,10) == 0;
	question = "_I am an explorer with extremely poor luck._";
	text1 = "_Not much luck in the Aram Peaks, true._ He quietly notes the regal insignia on your shoulder, but he doesn't comment on it. _Both us locked in a frozen crypt, after all._";

begintalknode;
	state = 10;
	nextstate = 11;
	condition = gf(63,10) == 0 && gf(62,11) > 0;
	question = "_Nilzichek sent me to find you._";
	text1 = "That improves his morale. _Really? You met my friend, and he actually enlisted you?_ He quietly notes the regal insignia on your shoulder, but he doesn't comment on it. _I apologize. He didn't mean to get you locked in a frozen crypt, I'm sure._";

begintalknode;
	state = 11;
	nextstate = 10;
	condition = 1;
	question = "_Yes, we are trapped._";
	text1 = "_But perhaps not for long. There is a locked door to the west, which offers hope of escape. I am able to pick the lock, but I didn't want to proceed alone. With a mighty warrior like you, there is hope!_";
	code =
		sf(63,10,1);
	break;
	
begintalknode;
	state = 10;
	nextstate = 12;
	condition = gf(63,10) > 0;
	question = "_What are you doing here?_";
	text1 = "_Nothing noble. I was exploring a ruin in the Low Dhaga with my business partner. While scurrying through the tunnels, looking in vain for valuable artifacts, I found a scroll describing this library._";
	text2 = "_I couldn't resist the temptation, alas._";

begintalknode;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "_Tell me about your business partner?_";
	text1 = "_He is Nilzichek the Profferer, finest trader in the Rokaj. I loot the finest old junk, and he makes the best possible deals for it. A legendary partnership._";

begintalknode;
	state = 12;
	nextstate = -1;
	condition = 1;
	question = "_Where were you exploring before this?_";
	text1 = "_A smoky, unpleasant ruin in the Low Dhaga. Northeast corner. Hard to find. Mostly picked over. I was eager to leave it. Perhaps I should have prepared better, though._";

begintalknode;
	state = 12;
	nextstate = 13;
	condition = 1;
	question = "_Why did you come here?_";
	text1 = "_Greed. The Rokaj is full of ruins, but most of them have been heavily picked over. This is a fresh source of rare artifacts. Might be able to get rich here, if I live._";

begintalknode;
	state = 13;
	nextstate = -1;
	condition = 1;
	question = "_Is there much wealth to be found here?_";
	text1 = "He thinks about it. _Actually, no. The treasure is scrolls. Unreadable scrolls. Maybe valuable to scholars, but I only want that which can be sold for ready money._";
	text2 = "_A pretty foolish expedition, all considered._";

begintalknode;
	state = 13;
	nextstate = -1;
	condition = 1;
	question = "_What did you find here?_";
	text1 = "_Scrolls. Scrolls and scrolls. Not magical. Just ... I don't even know what they are about._";
	text2 = "_There were also traps. As you saw. I know why this place has been unlooted for so long._";

begintalknode;
	state = 10;
	nextstate = 14;
	condition = gf(63,10) > 0;
	question = "_What are the library's traps?_";
	text1 = "_You already saw the gate that closed us in. It slams shut whenever I try to return to my camp. The only escape is ahead._";
	text2 = "_There are also the deadly shades that wander. Try not to be too frightened by the eerie noises that go on in there. The real problem is ... the big sentinel._";
	
begintalknode;
	state = 14;
	nextstate = -1;
	condition = 1;
	question = "_Where do the shades wander?_";
	text1 = "_They walk the halls of the library. Then they hunt outside. Then they return. Hopefully, when you approached the library, you evaded them. When they detect intruders, they flit home to protect the scrolls. The useless, worthless scrolls._";

begintalknode;
	state = 14;
	nextstate = 15;
	condition = 1;
	question = "_Who is the big sentinel?_";
	text1 = "_You probably saw it when you entered. The big rocky fellow at the entrance. It walks around from time to time._";

begintalknode;
	state = 15;
	nextstate = -1;
	condition = 1;
	question = "_That thing can walk?_";
	text1 = "_Amazing, isn't it? The magic that animated it still remains. Fortunately, it's a slow, dumb beast. Easy to avoid._";
	text2 = "You suspect that something is going unsaid here.";

begintalknode;
	state = 10;
	nextstate = 16;
	condition = gf(63,10) > 0;
	question = "_I am ready to escape._";
	text1 = "_Then follow me. I will unlock the door to the west, and we can thread our way through the ruin. There must be an escape route somewhere!_";
	text2 = "His morale is quite high. He seems strangely unworried.";

begintalknode;
	state = 16;
	nextstate = -1;
	condition = 1;
	question = "_Just wait here for now._";
	text1 = "_Oh. I ... Well, I mean, I am starving. I'll wait a bit, but let's not linger long._";
	action = END_TALK;
	
begintalknode;
	state = 16;
	nextstate = -1;
	condition = 1;
	question = "_Let's go._";
	text1 = "_At last!_ He jumps to his feet and walks out of the room. For a moment, you think he fingers something in his pocket. Then he is gone. He calls to you, _Follow!_";
	action = END_TALK;
	code =
		sf(63,10,2);
	break;

begintalknode;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "_Just stay here for now._";
	text1 = "He deflates a bit. The delay plainly irritates him. _Of course. I'll just freeze and starve. As will you._";
	text2 = "He starts to shiver harder. _You'll have some very important decisions to make. So, please, for all our sakes, don't be a fool. When you're done with your futile search for an escape route, I'll be here._";
	action = END_TALK;
	
//

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 40;
	condition = 1;
	question = "Name";
	text1 = "Ezequiel pulls his hands out of his pockets. One of them brings forth a few lockpicks. _Now I'll get this door open and we can run to safety._";
	code =
		set_attitude(6300,10);
		break;
		
begintalknode;
	state = 40;
	nextstate = 41;
	condition = 1;
	question = "_Maybe you should wait._";
	text1 = "He shakes his head. _We won't last long. We've waited long enough._ He gets to work.";

begintalknode;
	state = 40;
	nextstate = 41;
	condition = 1;
	question = "_All right._";
	text1 = "He nods. _We'll die if we don't get out soon. Be ready to run._ He gets to work.";

begintalknode;
	state = 41;
	nextstate = 42;
	condition = 1;
	question = "Watch.";
	text1 = "With two long pieces of bent wire, he makes short work of the lock. There is a satisfying click. _It's unlocked._";
	text2 = "A long moment of silence, as you prepare to open the door. And then ... A roar. A strange, inhuman, hellish keening, coming from the south. Then heavy footsteps. Something is walking. Though it is far away, the massive impacts of its feet make the floor vibrate.";
	code =
		sf(63,9,1);
	break;
	
begintalknode;
	state = 42;
	nextstate = 43;
	condition = 1;
	question = "_WHAT WAS THAT!?_";
	text1 = "_Oh. That. The sentinel by the entrance. I thought it would leave us alone. Apparently, it's hunting. We should probably run. It seems quite strong._";

begintalknode;
	state = 43;
	nextstate = -1;
	condition = 1;
	question = "_You don't seem worried._";
	text1 = "_I'm terrified. Of course, I have royalty here with me. An experienced hunter. I'm sure you can help me to safety. Haven looks after its vassals, after all._";

begintalknode;
	state = 43;
	nextstate = 44;
	condition = 1;
	question = "_What do we do now?_";
	text1 = "_I'm not sure._";

begintalknode;
	state = 44;
	nextstate = -1;
	condition = 1;
	question = "_What do you mean, 'You aren't sure?'_";
	text1 = "_As I said, I don't know what is past this door. I am truly hoping for a way to escape._ The booming footsteps slowly grow closer. _I think we should just run._";

begintalknode;
	state = 44;
	nextstate = -1;
	condition = 1;
	question = "_Let's go. I'll keep you safe._";
	text1 = "_Open the door, and we shall escape! What a tale we will have to tell Nilzichek, if we are not ground to a pulp!_";
	action = END_TALK;

begintalknode;
	state = 44;
	nextstate = -1;
	condition = 1;
	question = "_Run!_";
	text1 = "_A quality plan, one I agree with completely. Open the door, and we shall escape! What a tale we will have to tell Nilzichek, if we are not ground to a pulp!_";
	action = END_TALK;


	
//

begintalknode;
	tag = 70;
	state = -1;
	nextstate = 70;
	condition = 1;
	question = "Name";
	text1 = "At last, the way to the exit is clear. Ezequiel reaches into his pocket. Then he gets a disappointed look on his face. He pulls out a handful of sand.";

begintalknode;
	state = 70;
	nextstate = 71;
	condition = 1;
	question = "_What was that sand?_";
	text1 = "_A charm. I found it here. It kept me safe from the sentinels, as long as I held it. Must have been made by the librarians._";

begintalknode;
	state = 71;
	nextstate = 70;
	condition = 1;
	question = "_You didn't tell me about it?_";
	text1 = "_Of course not! You can defend yourself! I'm just a scrawny, hungry looter._";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "_Do you know anything about the rebellion being planned outside?_";
	text1 = "_There's a rebellion?_";

begintalknode;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "_I need you to come with me._";
	text1 = "_A kind offer, but I must head downward with all speed. Nilzichek will be very worried about me._";

begintalknode;
	state = 70;
	nextstate = 75;
	condition = 1;
	question = "_Where will you go now?_";
	text1 = "_Back downward to the Low Dhaga. I have many stories to tell Nilzichek. Also, we need to find a better place to loot._";

begintalknode;
	state = 75;
	nextstate = -1;
	condition = 1;
	question = "_I should get a reward for rescuing you._";
	text1 = "_Of course. Go back to the Low Dhaga and talk to Nilzichek. We're rogues, but we're also proper Ro. We pay our way._";
	text2 = "_Now, excuse me. I need to get some food at my camp, and I need to get somewhere warm. I've had enough cold for my entire life. Thank you for your help, [P]. Goodbye!_ He slips through the door and is gone.";
	action = END_TALK;
	code =
		erase_char(6301);
	break;
	
begintalknode;
	state = 75;
	nextstate = -1;
	condition = 1;
	question = "_Goodbye._";
	text2 = "He nods. _I need to get some food at my camp, and I need to get somewhere warm. I've had enough cold for my entire life. Thank you for your help, [P]. Safe travels to you, noble rescuer!_ He slips through the door and is gone.";
	action = END_TALK;
	code =
		erase_char(6301);
	break;


//

begintalknode;
	tag = 100;
	state = -1;
	nextstate = 100;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 100;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

//

begintalknode;
	tag = 130;
	state = -1;
	nextstate = 130;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 130;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";

//

begintalknode;
	tag = 160;
	state = -1;
	nextstate = 160;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 160;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";
		
//

begintalknode;
	tag = 190;
	state = -1;
	nextstate = 190;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode;
	state = 190;
	nextstate = -1;
	condition = 1;
	question = "__";
	text1 = ".";
	text2 = "";
				